<template>
    <div>
        <a-modal
            title="合同审核单"
            :visible="visible"
            @ok="visible = false"
            @cancel="visible = false"
            :footer="null"
            class="contractPay-print-modal"
            :width="794+48+16"
        >
            <div style="width: 794px;">
                <div>
                    <a-button class="blue-btn" type="primary" v-print="printObj">打印</a-button>
                    <!-- <a-button v-if="isOaModal" class="blue-btn" style="margin-left: 10px;" @click="applyForView">绑定的行政审批单</a-button> -->
                </div>
                <div id="contractPay-print-ID">
                    <div v-for="(item,index) in printList" :key="index" class="contractPay-print-div">
                        <h1 class="table-title">自治区食品药品审评查验中心<br/>项目合同审核单</h1>
                        <table border="1" cellspacing="0" class="contractPay-table">
                            <tr>
                                <th>合同名称</th>
                                <td colspan="4">{{ item.fhtmc }}</td>
                            </tr>
                            <tr>
                                <th>合同编号</th>
                                <td colspan="2">{{ item.fhtbh?item.fhtbh:'-' }}</td>
                                <th>合同金额</th>
                                <td>{{ item.fhtje }} 元</td>
                            </tr>
                            <tr>
                                <th>所属项目编号</th>
                                <td colspan="2">{{ item.fssxmbh?item.fssxmbh:'-' }}</td>
                                <th>节约金额</th>
                                <td>{{ item.fjyje }} 元</td>
                            </tr>
                            <tr>
                                <th>采购代理机构</th>
                                <td colspan="2">{{ item.fcgdljg?item.fcgdljg:'-' }}</td>
                                <th>采购方式</th>
                                <td>{{ item.fcgfs }}</td>
                            </tr>
                            <tr>
                                <th>是否属于政府采购</th>
                                <td colspan="2">{{ item.fsfzfcg }}</td>
                                <th>采购品目</th>
                                <td>{{ item.fcgpm }}</td>
                            </tr>
                            <tr>
                                <th>中标供应商名称</th>
                                <td colspan="4">{{ item.fzbgysmc }}</td>
                            </tr>
                            <tr>
                                <th rowspan="2">采购需求<br/>科室意见</th>
                                <th style="padding: 5px 0px;">经办人</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fjbrshyj }}</span>
                                        <span>
                                            <img v-if="getUrl('科室经办人审核')" :src="getUrl('科室经办人审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fjbrshr }}</span>
                                            <span>{{ item.fjbrshyjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th style="padding: 5px 0px;">负责人</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fksfzrshryj }}</span>
                                        <span>
                                            <img v-if="getUrl('科室负责人审核')" :src="getUrl('科室负责人审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fksfzrshr }}</span>
                                            <span>{{ item.fksfzrshryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr v-if="item.fcgpm == '课题'">
                                <th rowspan="2">质管科意见</th>
                                <th style="padding: 5px 0px;">经办人</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fzgkjbryj }}</span>
                                        <span>
                                            <img v-if="getUrl('质管科经办人审核')" :src="getUrl('质管科经办人审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fzgkjbr }}</span>
                                            <span>{{ item.fzgkjbryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr v-if="item.fcgpm == '课题'">
                                <th style="padding: 5px 0px;">负责人</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fzgkfzryj }}</span>
                                        <span>
                                            <img v-if="getUrl('质管科负责人审核')" :src="getUrl('质管科负责人审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fzgkfzr }}</span>
                                            <span>{{ item.fzgkfzryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th rowspan="3">办公室意见</th>
                                <th style="padding: 5px 0px;">法务人员</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fbgsfwshryj }}</span>
                                        <span>
                                            <img v-if="getUrl('办公室法务审核')" :src="getUrl('办公室法务审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fbgsfwshr }}</span>
                                            <span>{{ item.fbgsfwshryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th style="padding: 5px 0px;">财务人员</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fbgscwshryj }}</span>
                                        <span>
                                            <img v-if="getUrl('办公室财务审核')" :src="getUrl('办公室财务审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fbgscwshr }}</span>
                                            <span>{{ item.fbgscwshryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th style="padding: 5px 0px;">负责人</th>
                                <td colspan="3">
                                    <div class="contractPay-table-td-yj">
                                        <span>{{ item.fbgsfzrshryj }}</span>
                                        <span>
                                            <img v-if="getUrl('办公室负责人审核')" :src="getUrl('办公室负责人审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fbgsfzrshr }}</span>
                                            <span>{{ item.fbgsfzrshryjsj }}</span>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>采购需求科室<br/>分管领导意见</th>
                                <td colspan="4">
                                    <div style="padding: 10px 0px;">
                                        <span style="display: block;text-align: left;padding-left: 10px;">{{ item.ffgldshryj }}</span>
                                        <div class="yjqm-right-bottom">
                                            <img v-if="getUrl('分管领导审核')" :src="getUrl('分管领导审核')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.ffgldshr }}</span>
                                            <span>{{ item.ffgldshryjsj }}</span>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>主任意见</th>
                                <td colspan="4">
                                    <div style="padding: 10px 0px;">
                                        <span style="display: block;text-align: left;padding-left: 10px;">{{ item.fzxldspyj }}</span>
                                        <div class="yjqm-right-bottom">
                                            <img v-if="getUrl('中心主任审批')" :src="getUrl('中心主任审批')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ item.fzxldspr }}</span>
                                            <span>{{ item.fzxldspyjsj }}</span>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <div style="page-break-after:always"></div>
                    </div>
                </div>
            </div>
        </a-modal>
        <oaModal v-show="false" ref="oaModalRef" ></oaModal>
    </div>
</template>
<script>
import {
    downMyQm,
} from './service/index'
import moment from 'moment'
export default {
    components:{
        oaModal: () => import('@/views/administrativeOffice-new/yiBan/index')
    },
    props:{
        isOaModal:{
            type:Boolean,
            default:false,
            required:false,
        },
    },
    data(){
        return{
            moment:moment,
            visible:false,
            formState:{},
            printList: [],
            qmImgList: [],
            laborCostsList: [],
            printObj:{
                id:"contractPay-print-ID", //需要打印的id名称
                popTitle:"自治区食品药品审评查验中心项目合同审核单",//文档的名称
                // preview:true,//预览功能，不好用
                zIndex:'20002',
                beforeOpenCallback(vue){
                    //console.log('打印回调',vue)
                },
                openCallback (vue) {//打开之前
                    //console.log('打开之前',vue)
                },
                closeCallback (vue) {//关闭了打印工具
                    //console.log('关闭了打印工具')
                },
            },
        }
    },
    watch:{

    },
    mounted(){

    },
    methods:{
        getData(val,qmVal){
            //console.log('打印数据qmVal',qmVal)
            this.printList = []
            this.qmImgList = []
            typeof val == 'object' ? this.printList.push(val):this.printList = val
            this.qmImgList = qmVal
            //console.log('打印数据',this.printList)
            this.visible = true
        },
        printClick(){

        },
        applyForView(){
            this.$refs.oaModalRef.reviseClick({fpid:this.printList[0].fxzswid,flcmb:'OA_XZSWSP'})
        },
        // 签名图片
        getUrl(hjmcName){
            let url = ''
            if(this.qmImgList.length){
                this.qmImgList.forEach(item => {
                    if(item.hjmc == hjmcName){
                        url = item.url
                    }
                })
            }
            return url
        },
    }
}
</script>
<style lang="less">
@media print {
    .contractPay-print-div {
        padding-top: 80px;
    }
}
#contractPay-print-ID {
    .table-title {
        font-family: "FZXiaoBiaoSong-S04S", "方正小标宋简体", sans-serif;
        font-size: 29px;
    }
    .contractPay-print-div {
        text-align: center;
        margin: 0 auto;
        .contractPay-table{
            width: 794px;
            margin: 0 auto;
            margin-top: 4mm;
            font-size: 16px;
            table-layout: fixed;
            th {
                font-family: 'SimSun', serif;
                text-align: center;
                font-size: 18px;
                font-weight: bold !important;
                line-height: 2.5;
                padding: 0px;
                color: black;
            }
            td {
                font-family: 'SimSun', serif;
                min-width: 150px;
                text-align: center;
                line-height: 1.5;
                padding: 0px;
                font-size: 18px;
                color: black;
                word-wrap:break-word;
                word-break:break-all;
                white-space:normal;
                .ant-form-item {
                    margin-bottom: 0px;
                }
            }
            .contractPay-table-td-yj {
                display: flex;
                justify-content: space-between;
                padding: 0px 10px;
            }
        }
        .table-bz {
            font-family: '宋体', sans-serif;
            font-size: 14px;
        }
        .text-align-left {
            text-align: left !important;
            padding-left: 10px !important;
        }
        .yjqm-right-bottom {
            float: right;
            margin-right: 20px;
            margin-bottom: 10px;
            line-height: 30px;
        }
        .yjqmImg {
            width: 100px;
            height: 30px;
            padding-right: 20px;
        }
    }
    .normal-table {
        table {
            border-color: black;
            border-top: 2px solid ;
            border-left: 2px solid ;
            border-right: 2px solid ;
            border-bottom: 2px solid ;
          }
    }
}
</style>
